//
//  ECMineProfileTypeTwoCell.m
//  Edu_iOS2018
//
//  Created by apple on 2018/1/16.
//  Copyright © 2018年 yanyan. All rights reserved.
//

#import "ECMineProfileTypeTwoCell.h"
#import "CYDataHelper.h"

@interface ECMineProfileTypeTwoCell(){
    
    UILabel *typeLab;
    UILabel *contentLab;
}


@end

@implementation ECMineProfileTypeTwoCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = 0;
        
        [self setCellUI];
    }
    return self;
}

-(void)setCellUI{
    typeLab = [[UILabel alloc]init];
    [self.contentView addSubview:typeLab];
    typeLab.textColor = [UIColor colorWithHexString:@"#999999"];
    
    UIImageView *arrowImage =[[UIImageView alloc]init];
    [self.contentView addSubview:arrowImage];
    [arrowImage setImage:[UIImage imageNamed:@"MIne_safeArrow"]];
    
    UIView *lineView = [[UIView alloc]init];
    [self.contentView addSubview:lineView];
    lineView.backgroundColor = [UIColor colorWithHexString:@"#e5e5e5"];
    
    contentLab = [[UILabel alloc]init];
    [self.contentView addSubview:contentLab];
    contentLab.numberOfLines = 0;
    contentLab.textColor = [UIColor colorWithHexString:@"#1a1a1a"];
    contentLab.font = [UIFont systemFontOfSize:16*kPercentage];
    
    WeakSelf(weakSelf);
    [typeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.contentView.mas_left).offset(kProportion_Width(45));
        make.top.equalTo(weakSelf.contentView.mas_top).offset(kProportion_Height(50));
        make.width.equalTo(@100);
        make.height.equalTo(@18);
    }];
    
    [arrowImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(typeLab.mas_centerY);
        make.right.equalTo(weakSelf.contentView.mas_right).offset(-kProportion_Width(45));
        make.width.equalTo(@(kProportion_Height(17)));
        make.height.equalTo(arrowImage.mas_width).multipliedBy(38.f/17.f);
    }];
    
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(typeLab.mas_bottom).offset(kProportion_Height(50));
        make.left.equalTo(typeLab.mas_left);
        make.right.equalTo(arrowImage.mas_right);
        make.height.equalTo(@1);
    }];
    
    [contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(lineView.mas_left);
        make.right.equalTo(lineView.mas_right);
        make.top.equalTo(lineView).offset(kProportion_Height(45));
        make.bottom.equalTo(weakSelf.contentView.mas_bottom).offset(-kProportion_Height(45));
    }];

}


-(void)setContentWithData:(NSMutableArray *)nameArray andIndexPath:(NSIndexPath *)indexPath{
    
    typeLab.text = nameArray[indexPath.section][0];
    NSString *str = nameArray[indexPath.section][1];
    //判断(个签/自我介绍)是否有内容
    if ([CYDataHelper isNull:str]) {
        str = @"这个人很懒,什么都没有写~";
        contentLab.textColor = [UIColor colorWithHexString:@"#cccccc"];
    }else{
        contentLab.textColor = [UIColor colorWithHexString:@"#1a1a1a"];
    }
    contentLab.text = str;
}


@end
